#include "SVCameraFactory.h"

SVCamera *SVCameraFactory::create(const CameraType type, QObject *parent)
{
    switch (type) {
    case CameraType::AGORA:
        return nullptr;
    case CameraType::WEBRTC:
        return nullptr;
    }
    return nullptr;
}

SVCamera *SVCameraFactory::create(const char *name, QObject *parent)
{
    Q_ASSERT(name);
    if (!name) {
        return nullptr;
    }
    if (qstricmp(name, "agora") == 0) {
        return nullptr;
    }
    if (qstricmp(name, "webrtc") == 0) {
        return nullptr;
    }
    return nullptr;
}

SVCamera *SVCameraFactory::create(QObject *parent)
{
    const QString preferred =
        qEnvironmentVariable("AVCALL_PREFERRED_ENGINE", QStringLiteral("agora"));
    if (const auto engine = create(qUtf8Printable(preferred), parent)) {
        return engine;
    }
    if (const auto engine = create("webrtc", parent)) {
        return engine;
    }
    return nullptr;
}
